3.1086 \(\int \frac {1}{(a+i a \tan (e+f x)) (c+d \tan (e+f x))} \, dx\)

Optimal. Leaf size=128 \[ -\frac {d^2 \log (c \cos (e+f x)+d \sin (e+f x))}{a f (-d+i c) \left (c^2+d^2\right )}-\frac {c d x}{a (-d+i c) \left (c^2+d^2\right )}-\frac {1}{2 f (-d+i c) (a+i a \tan (e+f x))}+\frac {x}{2 a (c+i d)} \]

[Out]

1/2*x/a/(c+I*d)-c*d*x/a/(I*c-d)/(c^2+d^2)-d^2*ln(c*cos(f*x+e)+d*sin(f*x+e))/a/(I*c-d)/(c^2+d^2)/f-1/2/(I*c-d)/
f/(a+I*a*tan(f*x+e))

________________________________________________________________________________________

Rubi [A]  time = 0.14, antiderivative size = 128, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 5, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.179, Rules used = {3551, 3479, 8, 3484, 3530} \[ -\frac {d^2 \log (c \cos (e+f x)+d \sin (e+f x))}{a f (-d+i c) \left (c^2+d^2\right )}-\frac {c d x}{a (-d+i c) \left (c^2+d^2\right )}-\frac {1}{2 f (-d+i c) (a+i a \tan (e+f x))}+\frac {x}{2 a (c+i d)} \]

Antiderivative was successfully verified.

[In]

Int[1/((a + I*a*Tan[e + f*x])*(c + d*Tan[e + f*x])),x]

[Out]

x/(2*a*(c + I*d)) - (c*d*x)/(a*(I*c - d)*(c^2 + d^2)) - (d^2*Log[c*Cos[e + f*x] + d*Sin[e + f*x]])/(a*(I*c - d
)*(c^2 + d^2)*f) - 1/(2*(I*c - d)*f*(a + I*a*Tan[e + f*x]))

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 3479

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(a*(a + b*Tan[c + d*x])^n)/(2*b*d*n), x] +
Dist[1/(2*a), Int[(a + b*Tan[c + d*x])^(n + 1), x], x] /; FreeQ[{a, b, c, d}, x] && EqQ[a^2 + b^2, 0] && LtQ[n
, 0]

Rule 3484

Int[((a_) + (b_.)*tan[(c_.) + (d_.)*(x_)])^(-1), x_Symbol] :> Simp[(a*x)/(a^2 + b^2), x] + Dist[b/(a^2 + b^2),
 Int[(b - a*Tan[c + d*x])/(a + b*Tan[c + d*x]), x], x] /; FreeQ[{a, b, c, d}, x] && NeQ[a^2 + b^2, 0]

Rule 3530

Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(c*Log[Re
moveContent[a*Cos[e + f*x] + b*Sin[e + f*x], x]])/(b*f), x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d,
0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]

Rule 3551

Int[1/(((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])), x_Symbol] :> Dist[b/(
b*c - a*d), Int[1/(a + b*Tan[e + f*x]), x], x] - Dist[d/(b*c - a*d), Int[1/(c + d*Tan[e + f*x]), x], x] /; Fre
eQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0]

Rubi steps

\begin {align*} \int \frac {1}{(a+i a \tan (e+f x)) (c+d \tan (e+f x))} \, dx &=\frac {\int \frac {1}{a+i a \tan (e+f x)} \, dx}{c+i d}-\frac {d \int \frac {1}{c+d \tan (e+f x)} \, dx}{a (i c-d)}\\ &=-\frac {c d x}{a (i c-d) \left (c^2+d^2\right )}-\frac {1}{2 (i c-d) f (a+i a \tan (e+f x))}+\frac {\int 1 \, dx}{2 a (c+i d)}-\frac {d^2 \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{a (i c-d) \left (c^2+d^2\right )}\\ &=\frac {x}{2 a (c+i d)}-\frac {c d x}{a (i c-d) \left (c^2+d^2\right )}-\frac {d^2 \log (c \cos (e+f x)+d \sin (e+f x))}{a (i c-d) \left (c^2+d^2\right ) f}-\frac {1}{2 (i c-d) f (a+i a \tan (e+f x))}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]  time = 1.29, size = 206, normalized size = 1.61 \[ \frac {-2 i c^2 f x+c^2+2 d^2 \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )-4 d^2 (\tan (e+f x)-i) \tan ^{-1}\left (\frac {c \sin (f x)+d \cos (f x)}{d \sin (f x)-c \cos (f x)}\right )+\tan (e+f x) \left (2 i d^2 \log \left ((c \cos (e+f x)+d \sin (e+f x))^2\right )+(c+i d) (2 c f x-i c+2 i d f x-d)\right )+4 c d f x+2 i d^2 f x+d^2}{4 a f (c-i d) (c+i d)^2 (\tan (e+f x)-i)} \]

Antiderivative was successfully verified.

[In]

Integrate[1/((a + I*a*Tan[e + f*x])*(c + d*Tan[e + f*x])),x]

[Out]

(c^2 + d^2 - (2*I)*c^2*f*x + 4*c*d*f*x + (2*I)*d^2*f*x + 2*d^2*Log[(c*Cos[e + f*x] + d*Sin[e + f*x])^2] + ((c
+ I*d)*((-I)*c - d + 2*c*f*x + (2*I)*d*f*x) + (2*I)*d^2*Log[(c*Cos[e + f*x] + d*Sin[e + f*x])^2])*Tan[e + f*x]
 - 4*d^2*ArcTan[(d*Cos[f*x] + c*Sin[f*x])/(-(c*Cos[f*x]) + d*Sin[f*x])]*(-I + Tan[e + f*x]))/(4*a*(c - I*d)*(c
 + I*d)^2*f*(-I + Tan[e + f*x]))

________________________________________________________________________________________

fricas [A]  time = 0.48, size = 121, normalized size = 0.95 \[ \frac {{\left ({\left (-2 i \, c^{2} + 4 \, c d - 6 i \, d^{2}\right )} f x e^{\left (2 i \, f x + 2 i \, e\right )} + 4 \, d^{2} e^{\left (2 i \, f x + 2 i \, e\right )} \log \left (\frac {{\left (i \, c + d\right )} e^{\left (2 i \, f x + 2 i \, e\right )} + i \, c - d}{i \, c + d}\right ) + c^{2} + d^{2}\right )} e^{\left (-2 i \, f x - 2 i \, e\right )}}{{\left (-4 i \, a c^{3} + 4 \, a c^{2} d - 4 i \, a c d^{2} + 4 \, a d^{3}\right )} f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="fricas")

[Out]

((-2*I*c^2 + 4*c*d - 6*I*d^2)*f*x*e^(2*I*f*x + 2*I*e) + 4*d^2*e^(2*I*f*x + 2*I*e)*log(((I*c + d)*e^(2*I*f*x +
2*I*e) + I*c - d)/(I*c + d)) + c^2 + d^2)*e^(-2*I*f*x - 2*I*e)/((-4*I*a*c^3 + 4*a*c^2*d - 4*I*a*c*d^2 + 4*a*d^
3)*f)

________________________________________________________________________________________

giac [A]  time = 0.42, size = 180, normalized size = 1.41 \[ -\frac {-\frac {8 i \, d^{3} \log \left (-i \, d \tan \left (f x + e\right ) - i \, c\right )}{2 \, a c^{3} d + 2 i \, a c^{2} d^{2} + 2 \, a c d^{3} + 2 i \, a d^{4}} - \frac {{\left (-i \, c + 3 \, d\right )} \log \left (i \, \tan \left (f x + e\right ) + 1\right )}{a c^{2} + 2 i \, a c d - a d^{2}} - \frac {8 \, \log \left (\tan \left (f x + e\right ) + i\right )}{-8 i \, a c - 8 \, a d} - \frac {i \, c \tan \left (f x + e\right ) - 3 \, d \tan \left (f x + e\right ) + 3 \, c + 5 i \, d}{{\left (a c^{2} + 2 i \, a c d - a d^{2}\right )} {\left (\tan \left (f x + e\right ) - i\right )}}}{4 \, f} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="giac")

[Out]

-1/4*(-8*I*d^3*log(-I*d*tan(f*x + e) - I*c)/(2*a*c^3*d + 2*I*a*c^2*d^2 + 2*a*c*d^3 + 2*I*a*d^4) - (-I*c + 3*d)
*log(I*tan(f*x + e) + 1)/(a*c^2 + 2*I*a*c*d - a*d^2) - 8*log(tan(f*x + e) + I)/(-8*I*a*c - 8*a*d) - (I*c*tan(f
*x + e) - 3*d*tan(f*x + e) + 3*c + 5*I*d)/((a*c^2 + 2*I*a*c*d - a*d^2)*(tan(f*x + e) - I)))/f

________________________________________________________________________________________

maple [A]  time = 0.28, size = 155, normalized size = 1.21 \[ -\frac {i \ln \left (\tan \left (f x +e \right )+i\right )}{f a \left (4 i d -4 c \right )}-\frac {i d^{2} \ln \left (c +d \tan \left (f x +e \right )\right )}{f a \left (i d -c \right ) \left (i d +c \right )^{2}}+\frac {1}{f a \left (2 i d +2 c \right ) \left (\tan \left (f x +e \right )-i\right )}-\frac {i \ln \left (\tan \left (f x +e \right )-i\right ) c}{4 f a \left (i d +c \right )^{2}}+\frac {3 \ln \left (\tan \left (f x +e \right )-i\right ) d}{4 f a \left (i d +c \right )^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/(a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x)

[Out]

-I/f/a/(4*I*d-4*c)*ln(tan(f*x+e)+I)-I/f/a*d^2/(I*d-c)/(c+I*d)^2*ln(c+d*tan(f*x+e))+1/f/a/(2*I*d+2*c)/(tan(f*x+
e)-I)-1/4*I/f/a/(c+I*d)^2*ln(tan(f*x+e)-I)*c+3/4/f/a/(c+I*d)^2*ln(tan(f*x+e)-I)*d

________________________________________________________________________________________

maxima [F(-2)]  time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: RuntimeError} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError >> ECL says: Error executing code in Maxima: expt: undefined: 0 to a negative e
xponent.

________________________________________________________________________________________

mupad [B]  time = 9.31, size = 2639, normalized size = 20.62 \[ \text {result too large to display} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(1/((a + a*tan(e + f*x)*1i)*(c + d*tan(e + f*x))),x)

[Out]

symsum(log(-a*d^2*(c*1i + d)^2*(c*d + d^2*tan(e + f*x) + d^2*2i + 2*root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*
e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d
^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k)*a*c^3 - root(a^3*c^3*d^3*e
^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16
*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k)*a*
d^3*2i - 8*root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*
e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e
 - c*d^2*1i + 3*d^3, e, k)^2*a^2*c^4*tan(e + f*x) - 24*root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*
c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*
d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k)^2*a^2*d^4*tan(e + f*x) - 6*root(a^3*c^3
*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^
3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e,
 k)*a*c*d^2 + root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d
^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^
4*e - c*d^2*1i + 3*d^3, e, k)*a*c^2*d*6i - 12*root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e
^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i +
a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k)*a*d^3*tan(e + f*x) + root(a^3*c^3*d^3*e^3*64i +
16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*
e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k)^2*a^2*c^2*d
^2*64i - 32*root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5
*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*
e - c*d^2*1i + 3*d^3, e, k)^2*a^2*c*d^3 + 32*root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^
3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a
*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k)^2*a^2*c^3*d + root(a^3*c^3*d^3*e^3*64i + 16*a^3*c
^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*
a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k)^2*a^2*c*d^3*tan(e +
 f*x)*48i - root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5
*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*
e - c*d^2*1i + 3*d^3, e, k)^2*a^2*c^3*d*tan(e + f*x)*16i + root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*
a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*
c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k)*a*c*d^2*tan(e + f*x)*16i + 4*root(a
^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*
d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d
^3, e, k)*a*c^2*d*tan(e + f*x) + 32*root(a^3*c^3*d^3*e^3*64i + 16*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c
^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*
4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k)^2*a^2*c^2*d^2*tan(e + f*x)))*root(a^3*c^3*d^3*e^3*64i + 16
*a^3*c^4*d^2*e^3 - 16*a^3*c^2*d^4*e^3 + a^3*c^5*d*e^3*32i + a^3*c*d^5*e^3*32i - 16*a^3*d^6*e^3 + 16*a^3*c^6*e^
3 - 2*a*c^2*d^2*e + a*c^3*d*e*4i + a*c*d^3*e*4i + 13*a*d^4*e + a*c^4*e - c*d^2*1i + 3*d^3, e, k), k, 1, 3)/f +
 1/(2*f*(a*d - a*c*1i + a*c*tan(e + f*x) + a*d*tan(e + f*x)*1i))

________________________________________________________________________________________

sympy [A]  time = 5.02, size = 253, normalized size = 1.98 \[ \frac {x \left (- c - 3 i d\right )}{- 2 a c^{2} - 4 i a c d + 2 a d^{2}} + \begin {cases} \frac {i e^{- 2 i f x}}{4 a c f e^{2 i e} + 4 i a d f e^{2 i e}} & \text {for}\: 4 a c f e^{2 i e} + 4 i a d f e^{2 i e} \neq 0 \\x \left (- \frac {- c - 3 i d}{- 2 a c^{2} - 4 i a c d + 2 a d^{2}} + \frac {- i c e^{2 i e} - i c + 3 d e^{2 i e} + d}{- 2 i a c^{2} e^{2 i e} + 4 a c d e^{2 i e} + 2 i a d^{2} e^{2 i e}}\right ) & \text {otherwise} \end {cases} + \frac {i d^{2} \log {\left (\frac {i c - d}{i c e^{2 i e} + d e^{2 i e}} + e^{2 i f x} \right )}}{a f \left (c - i d\right ) \left (c + i d\right )^{2}} \]

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(1/(a+I*a*tan(f*x+e))/(c+d*tan(f*x+e)),x)

[Out]

x*(-c - 3*I*d)/(-2*a*c**2 - 4*I*a*c*d + 2*a*d**2) + Piecewise((I*exp(-2*I*f*x)/(4*a*c*f*exp(2*I*e) + 4*I*a*d*f
*exp(2*I*e)), Ne(4*a*c*f*exp(2*I*e) + 4*I*a*d*f*exp(2*I*e), 0)), (x*(-(-c - 3*I*d)/(-2*a*c**2 - 4*I*a*c*d + 2*
a*d**2) + (-I*c*exp(2*I*e) - I*c + 3*d*exp(2*I*e) + d)/(-2*I*a*c**2*exp(2*I*e) + 4*a*c*d*exp(2*I*e) + 2*I*a*d*
*2*exp(2*I*e))), True)) + I*d**2*log((I*c - d)/(I*c*exp(2*I*e) + d*exp(2*I*e)) + exp(2*I*f*x))/(a*f*(c - I*d)*
(c + I*d)**2)

________________________________________________________________________________________